﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="qunfa.aspx.cs" Inherits="MxWeiXinPF.Web.admin.crm.qunfa" %>


<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
    <title>群发</title>
   <%=PageJSAndStype("edit").ToString() %>
    <script type="text/javascript">

        $(function () {
            //初始化表单验证
            $("#form1").initValidform();

          
   //初始化上传控件
        $(".upload-img").InitUploader({ filesize: "<%=siteConfig.imgsize %>", sendurl: "../../tools/upload_ajax.ashx", swf: "../../scripts/webuploader/uploader.swf", filetypes: "<%=siteConfig.fileextension %>" });
       
        $(".upload-album").InitUploader({ btntext: "批量上传", multiple: true, water: true, thumbnail: true, filesize: "<%=siteConfig.imgsize %>", sendurl: "../../tools/upload_ajax.ashx", swf: "../../scripts/webuploader/uploader.swf" });
 

            $("input[name='rblResponseType']").click(function () {

                if ($(this).val() == "1") {
                    //文本
                    $(".wenben").show();
                    $(".music").hide();
                    $(".picnews").hide();

                }
                else if ($(this).val() == "0") {
                    //图文
                    $(".picnews").show();
                    $(".music").hide();
                    $(".wenben").hide();


                }


            });

            $("#btnSubmit").click(function () {
                var rType = $("input[name='rblResponseType']:checked").val();

                if (rType == "1") {
                    var txtContent = $("#txtContent").val();

                    if ($.trim(txtContent) == "") {
                        myalert("请填写内容");
                        return false;
                    }

                }
                else if (rType == "0") {
                    var txtContent = $("#hidCategoryId").val();

                    if ($.trim(txtContent) == "0") {
                        myalert("请选择图文素材！");
                        return false;
                    }

                }
                var msg = "此操作将内容发送给粉丝，切无法撤回，是否继续？";
                $.dialog.confirm(msg, function () {
                    $("#btnSendQunFa").click();

                });
                return false;


            });

            //图文添加按钮
            $("#itemAddButton").click(function () {

                showGuiZeDialog(0);
            });

        });

        //创建图文的窗口
        function showGuiZeDialog(id) {

            var rid = $("#hidId").val();
            var act = $("#lblact").text();
 
            var d = top.dialog({
                title: '添加图文素材',
                url: "crm/select_sucai.aspx",
                height: 420,
                width: 540,
                onclose: function () {

                    var imgUrl = this.returnValue; //获取返回值
                  
                    if (imgUrl.length > 0) {

                        var vArr = imgUrl.split('_');

                        $("#hidCategoryId").val(vArr[0]);
                        $("#lblCategoryTitle").text(vArr[1]);

                        $("#twDelete").show();
                        $("#dlSelectSC").hide();


                       
                    }


                }
            }).showModal();

        }

        //执行回传函数
        function DelExePostBack(obj) {
            var objid = obj.id;
            re = new RegExp("_", "g");
            var objid = objid.replace(re, "$");

            var msg = "删除记录后不可恢复，您确定吗？";
            $.dialog.confirm(msg, function () {

                __doPostBack(objid, '');
            });
            return false;
        }

        function deleteContent() {

            $("#hidCategoryId").val(0);
            $("#lblCategoryTitle").text("");
            $("#dlSelectSC").show();
            $("#twDelete").hide();

        }
    </script>


</head>

<body class="mainbody">
    <form id="form1" runat="server">


        <!--内容-->
        <asp:HiddenField ID="hidId" runat="server" Value="0" />
        <asp:Label ID="lblact" runat="server" Text="" Style="display: none;"></asp:Label>
        <asp:Label ID="lblreqestType" runat="server" Text="" Style="display: none;"></asp:Label>

<div id="floatHead" class="content-tab-wrap">
  <div class="content-tab">
    <div class="content-tab-ul-wrap">

                    <ul>
                        <li><a href="javascript:;" onclick="tabs(this);" class="selected">微信群发</a></li>
                        <li><a href="javascript:;" onclick="tabs(this);">微信说明</a></li>
                        <li><a href="yulanOpenid.aspx" onclick="tabs(this);">预览设置</a></li>
                    </ul>
                </div>
            </div>
        </div>

        <div class="tab-content">
            <!-- 群发人员 begin -->
            <div class="qfPersonDiv">

                <dl>
                    <dt>组别</dt>
                    <dd>
                        <div class="rule-multi-radio">
                            <asp:RadioButtonList ID="cblGroup" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                            </asp:RadioButtonList>

                        </div>
                    </dd>
                </dl>

            </div>


            <!-- 群发人员 end -->


            <!-- 群发内容设置 begin -->
            <div class="qcContentDiv">

                <dl>
                    <dt>图文类型</dt>
                    <dd>
                        <div class="rule-multi-radio">
                            <asp:RadioButtonList ID="rblResponseType" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                                <asp:ListItem Value="1" Selected="True">纯文本</asp:ListItem>
                                <asp:ListItem Value="0">图文</asp:ListItem>

                            </asp:RadioButtonList>
                        </div>
                    </dd>
                </dl>

                <dl class="wenben">
                    <dt>内容</dt>
                    <dd>
                        <asp:TextBox ID="txtContent" runat="server" CssClass="input" Style="height: 100px; width: 500px;" TextMode="MultiLine" datatype="*0-600" sucmsg="*最多600个字符 "></asp:TextBox>

                        <span class="Validform_checktip">*最多600个字符</span>
                    </dd>
                </dl>


                <dl class="picnews" style="display: none;" id="dlSelectSC">
                    <dd>
                        <a id="itemAddButton" class="icon-btn add"><i></i><span>从素材库中选择</span></a>
                    </dd>
                </dl>

                <dl class="picnews" style="display: none;" id="dlSCShow">
                    <dd id="tuwen_content">
                        <asp:HiddenField ID="hidCategoryId" runat="server" Value="0" />
                        <asp:Label ID="lblCategoryTitle" runat="server" Text=""></asp:Label>
                        <div style="height: 10px;">&nbsp;</div>
                        <div onclick="deleteContent()" class="btn yellow" id="twDelete" style="display: none;">删除</div>
                    </dd>

                </dl>

            </div>
            <!-- 群发内容设置 end -->
        </div>

        <div class="tab-content" style="display: none;">
            <dl>
                <dt style="color:red;">注：</dt>
                <dd style="color:red; font-size:16px;">
                    <pre>1、对于认证订阅号，<b>群发接口每天可成功调用1次，此次群发可选择发送给全部用户或某个分组</b>；
2、对于认证服务号虽然开发者使用高级群发接口的每日调用限制为100次，但是用户每月只能接收4条，<br /><b>无论在公众平台网站上，还是使用接口群发，用户每月只能接收4条群发消息，多于4条的群发将对该用户发送失败</b>；
3、具备微信支付权限的公众号，在使用群发接口上传、群发图文消息类型时，可使用&lt;a&gt;标签加入外链；
4、开发者可以使用预览接口校对消息样式和排版，通过预览接口可发送编辑好的消息给指定用户校验效果。
</pre>
                </dd>
            </dl>
            </div>

        <!--/内容-->

        <!--工具栏-->
        <div class="page-footer" runat="server">
            <div class="btn-list">
                <asp:Button ID="btnSendQunFa" runat="server" Text="立即群送" CssClass="btn" OnClick="btnSubmit_Click" Style="display: none;" />
                <asp:Button ID="btnSubmit" runat="server" Text="立即群送" CssClass="btn" />
                <asp:Button ID="Button1" runat="server" Text="个人微信预览" CssClass="btn yellow" OnClick="btnYuLan_Click" />
            </div>
            <div class="clear"></div>
        </div>
        <!--/工具栏-->
    </form>
</body>
</html>
